package com.example.demo.aop;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.example.demo.aop.asp.Method;
import com.example.demo.aop.asp.Method2;
@EnableTransactionManagement
public class Main {
	public static void main(String[] args) {
		AnnotationConfigApplicationContext app = new AnnotationConfigApplicationContext(AspectConfig.class);
		String[] beanDefinitionNames = app.getBeanDefinitionNames();
		for(String name:beanDefinitionNames) {
			System.out.println(name);
		}
		System.out.println("************************************");
		Method bean = (Method)app.getBean("method");
		bean.aspect();
		Method2 bean2 = (Method2)app.getBean("method2");
		bean2.aspect();
		app.close();
	}
}
